package com.dfbz.demo03_拷贝案例;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo03_字节流拷贝文本文件 {
    public static void main(String[] args) throws Exception {

        InputStream is = new FileInputStream("001.txt");
        OutputStream os =new FileOutputStream("csb.txt");

        byte[] data = new byte[3];

        int len;

        while ((len = is.read(data)) != -1) {
//            os.write(data,0,len);
            System.out.print(new String(data,0,len));
        }

        is.close();
        os.close();
    }
}
